using UnityEngine;

public class ItemObjectTrigger : MonoBehaviour
{
    private ItemObject myItemObject => GetComponentInParent<ItemObject>();

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.TryGetComponent(out Player player))
        {
            if (player.GetComponent<CharacterStats>().IsDead)
            {
                return;
            }
            myItemObject.PickupItem();
        }
    }
}
